﻿namespace Sidvall.LogManager.Data.Entity.Entities
{
    public partial class LogScopeItem : global::Sidvall.Data.DataRowBase, global::Sidvall.LogManager.Data.ILogScopeItem
    {
        #region Public Members

        #region CreatedTime

        private System.DateTime _CreatedTime;
        public System.DateTime CreatedTime
        { 
            get
            {
                return _CreatedTime;
            }
            set
            {
                _CreatedTime = Sidvall.Business.ValidationManager.GetValidUniversalDateTime(value, System.DateTimeKind.Utc);
            }
        }

        #endregion
        #region EventTypeId

        private int _EventTypeId;
        public int EventTypeId
        { 
            get
            {
                return _EventTypeId;
            }
            set
            {
                _EventTypeId = value;
            }
        }

        #endregion
        #region IdentityAuthenticationType

        private string _IdentityAuthenticationType;
        public string IdentityAuthenticationType
        { 
            get
            {
                return _IdentityAuthenticationType;
            }
            set
            {
                _IdentityAuthenticationType = value;
            }
        }

        #endregion
        #region IdentityName

        private string _IdentityName;
        public string IdentityName
        { 
            get
            {
                return _IdentityName;
            }
            set
            {
                _IdentityName = value;
            }
        }

        #endregion
        #region LogScopeId

        private long _LogScopeId;
        public long LogScopeId
        { 
            get
            {
                return _LogScopeId;
            }
            set
            {
                _LogScopeId = value;
            }
        }

        #endregion
        #region LogScopeItemId

        private long _LogScopeItemId;
        public long LogScopeItemId
        { 
            get
            {
                return _LogScopeItemId;
            }
            set
            {
                _LogScopeItemId = value;
            }
        }

        #endregion
        #region Message

        private string _Message;
        public string Message
        { 
            get
            {
                return _Message;
            }
            set
            {
                _Message = value;
            }
        }

        #endregion
        #region Title

        private string _Title;
        public string Title
        { 
            get
            {
                return _Title;
            }
            set
            {
                _Title = value;
            }
        }

        #endregion
        
        public virtual Sidvall.LogManager.Data.Entity.Entities.LogScope LogScope { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual System.Collections.Generic.ICollection<Sidvall.LogManager.Data.Entity.Entities.LogScopeItemCategory> LogScopeItemCategory { get; set; }
        
        #region DataRowContextStorageKey

        protected override string DataRowContextStorageKey
        {
            get
            {
                return global::Sidvall.LogManager.Data.Entity.SystemContext.Current.EntityFacade.LogScopeItemManager.GetKey(this);
            }
        }

        #endregion
        #region DataRowStateIsDirty

        protected override bool DataRowStateIsDirty
        {
            get
            {
                return global::Sidvall.LogManager.Data.Entity.SystemContext.Current.EntityFacade.LogScopeItemManager.DataRowStateIsDirty(this);
            }
        }

        #endregion

        #region ILogScopeItem Members

        System.DateTime global::Sidvall.LogManager.Data.ILogScopeItem.CreatedTime
        {
            get
            {
                return this._CreatedTime;
            }
            set
            {
                this.CreatedTime = value;
            }
        }
        global::Sidvall.Logging.EventType global::Sidvall.LogManager.Data.ILogScopeItem.EventTypeId
        {
            get
            {
                return (global::Sidvall.Logging.EventType)this._EventTypeId;
            }
            set
            {
                this.EventTypeId = (int)value;
            }
        }
        string global::Sidvall.LogManager.Data.ILogScopeItem.IdentityAuthenticationType
        {
            get
            {
                return this._IdentityAuthenticationType;
            }
            set
            {
                this.IdentityAuthenticationType = value;
            }
        }
        string global::Sidvall.LogManager.Data.ILogScopeItem.IdentityName
        {
            get
            {
                return this._IdentityName;
            }
            set
            {
                this.IdentityName = value;
            }
        }
        long global::Sidvall.LogManager.Data.ILogScopeItem.LogScopeId
        {
            get
            {
                return this._LogScopeId;
            }
            set
            {
                this.LogScopeId = value;
            }
        }
        System.Nullable<long> global::Sidvall.LogManager.Data.ILogScopeItem.LogScopeItemId
        {
            get
            {
                return this._LogScopeItemId;
            }
            set
            {
                if (value != null)
                    this.LogScopeItemId = value.Value;
            }
        }
        string global::Sidvall.LogManager.Data.ILogScopeItem.Message
        {
            get
            {
                return this._Message;
            }
            set
            {
                this.Message = value;
            }
        }
        string global::Sidvall.LogManager.Data.ILogScopeItem.Title
        {
            get
            {
                return this._Title;
            }
            set
            {
                this.Title = value;
            }
        }
        System.Nullable<System.Int32> global::Sidvall.LogManager.Data.ILogScopeItem.ServerConnectionId
        {
            get
            {
                return null;
            }
            set
            {
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        ILogScope global::Sidvall.LogManager.Data.ILogScopeItem.LogScope
        {
            get
            {
                return this.LogScope;
            }
            set
            {
                this.LogScope = value as LogScope;
            }
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
        System.Collections.Generic.IEnumerable<ILogScopeItemCategory> global::Sidvall.LogManager.Data.ILogScopeItem.LogScopeItemCategories
        {
            get
            {
                return this.LogScopeItemCategory;
            }
        }
        void global::Sidvall.LogManager.Data.ILogScopeItem.SetLogScopeItemCategories(Sidvall.Data.IDataRowProvider<global::Sidvall.LogManager.Data.ILogScopeItemCategory> items)
        {
            this.LogScopeItemCategory = items as LogScopeItemCategoryCollection;
        }

        #endregion

        #endregion
        #region Constructors

        public LogScopeItem() : this(false, null, null)
        {
        }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public LogScopeItem(bool initializeChildren, Sidvall.Data.IDataRowContextProvider context, Sidvall.Data.DataRowState? dataRowState)
        {
            if ((context != null) || (dataRowState != null))
                SetDataRowContext(context, dataRowState);
            if (initializeChildren)
            {
                this.LogScopeItemCategory = new System.Collections.Generic.List<LogScopeItemCategory>();
            }
        }

        #endregion
    }
}